<div class="main">
	<div class="inside">
		<h1>Showing products of category <?php echo $device;?></h1>
		<br/>
		<?php
		if(!empty($gadget['data'])){
			foreach($gadget['data'] as $key=>$value){

				$category = $value->category;
				$data = array(0=>$category->parentCategoryId);
				$dataKeyUrl = array($category->parentCategoryId=>$category->urlKey);
				$strCatId = $category->parentCategoryId;
				for($i=1;$i<=7;$i++){
					
					
					$subCat = Gadgetcategory::model()->findByPk($strCatId);
					
					
					if(!empty($subCat)){
						if($subCat->parentCategoryId!=null){
							$strCatId = $subCat->parentCategoryId;
							$data[$i] = $strCatId;
							
							$dataKeyUrl[$strCatId] = $subCat->urlKey;
						}
					}
					
					
				}
				$data = array_unique($data);
				sort($data);
				
				$strUrl = "";
				if(!empty($data)){
					foreach($data as $keyData=>$valueData){
						if(!empty($dataKeyUrl[$valueData])) $strUrl .= $dataKeyUrl[$valueData]."/";
					}
				}
				// dump($strUrl,false);
				// dump($data);
				
		?>
			<table style="margin-left:150px">
				<tr>
					<td>
					<a style='text-decoration:none' href='<?php echo Yii::app()->createUrl("trade/{$strUrl}{$value->urlKey}");?>'>
						<!--img src='< ?php echo Yii::app()->baseUrl;?>/uploads/products/fill/75-95/< ?php echo $value->imageUrl;?>' width='75'  height='95' /-->
						<img src='<?php echo Yii::app()->baseUrl;?>/uploads/products/<?php echo $value->imageUrl;?>' width='75'  height='95' />
					</a>				
					</td>
					<td>
						<br/>
						<h3>
							<a style='text-decoration:none' href='<?php echo Yii::app()->createUrl("trade/{$strUrl}{$value->urlKey}");?>'>
								<span class='orange'><?php echo $value->name;?></span>
							</a>					
						</h3>
						<b>Click to view Orange Offer for <?php echo $value->name;?>.
					</td>
				</tr>
			</table>
			<br/>
					<br/>
		<?php
			}
		}
		?>
	</div>
</div>